<template>
    <div class="cmdcfg">
        <exInput v-model="appPath" label="关闭路径" width="300" size="mini"></exInput>
    </div>
</template>


<script>

export default {
    props: {
        cmdInfo: { type: Object, default: {} },
        devInfo:{ type: Object, default: {} },
    },
    data() {
        return {
            appPath : this.cmdInfo.appPath || "com.xiaomi.youpin"
        };
    },
    inject: ['doDevCmd','doNextCmd'],
     

    mounted() {
    },

    methods: {
        setByDevInfo(){
            if(this.devInfo.curApp.indexOf("/")!=-1){
                this.appPath = this.devInfo.curApp.split("/")[0] || ""
            }else{
                this.appPath = this.devInfo.curApp || "";
            }
        },
        saveCmd(){
            this.cmdInfo.appPath = this.appPath;
        },
        preCheck(){
            if(!this.appPath){
                this.$message.error("关闭路径")
                return false;
            }
            return true;
        },
        runCmd(isOnce){
            if(!this.preCheck()){
                this.$emit("stopRun")
                return;
            }
            this.doDevCmd("adb shell am force-stop "+this.appPath);
            this.$emit("stopRun")
            if(isOnce!==true) this.doNextCmd();
        }
    }
}
</script>

<style lang="less" scoped>
    .cmdcfg{
        display: inline-block;
    }
</style>
